Skip to content

New generators-iterators tag - #2243

Closed
ghost wants to merge 20 commits into
mainfrom
unknown repository
Closed

ghost wants to merge 20 commits into
mainfrom
unknown repository

Conversation

@ghost

@ghost ghost commented Aug 5, 2022

Copy link
Copy Markdown

Would love all the feedback!

@ghost ghost changed the title New generator-iterator tag New generators-iterators tag Aug 5, 2022

@ionite34 ionite34 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few notes on Generators not being bound to functions, and fixing the inheritance explanation for Iterator -> Generator, instead of the other way around

@wookie184

Copy link
Copy Markdown
Contributor

This tag feels like it's trying to compare generators and iterators, which I don't think makes sense. Since a generator (function) returns an iterator, this feels a bit like comparing e.g. a BMW to a Car. Would two separate tags on the topics make more sense?

@swfarnsworth

Copy link
Copy Markdown
Contributor

Tags should be concise and answer a common question. If someone wants to know what a generator is, at a high-enough level that it can be answered concisely, I don't think many of the details here are relevant.

I would rather see a tag that gives an example of a generator created through a function, and an explanation of how the generator maintains its own state between yields (but preferably without the word "state").

@ghost

ghost commented Aug 5, 2022

Copy link
Copy Markdown
Author

This tag feels like it's trying to compare generators and iterators, which I don't think makes sense. Since a generator (function) returns an iterator, this feels a bit like comparing e.g. a BMW to a Car. Would two separate tags on the topics make more sense?

Well, maybe the wording in the file may lead you to think that its trying to compare an iterator and a generator, im not aiming to, im aiming to explain both concepts, if you have any suggestions especially about the wording, please let me know!

@ionite34
ionite34 self-requested a review August 6, 2022 18:06

@ionite34 ionite34 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like the proposed tag would be better focused on explanations of the creation of generators and generator expressions instead of custom Iterator classes, proposed a couple of changes in line with this.

Okimii and others added 7 commits August 6, 2022 16:22
Co-authored-by: Ionite <dev@ionite.io>
Co-authored-by: Ionite <dev@ionite.io>
Co-authored-by: Ionite <dev@ionite.io>
Co-authored-by: Ionite <dev@ionite.io>
Co-authored-by: Ionite <dev@ionite.io>
Co-authored-by: Ionite <dev@ionite.io>
@swfarnsworth
swfarnsworth self-requested a review August 6, 2022 20:35
@ionite34
ionite34 self-requested a review August 6, 2022 20:37
@swfarnsworth

Copy link
Copy Markdown
Contributor

Your understanding of Python's internals is impressive, but I feel that this tag focuses on the wrong details, and tags of this length are not likely to be read in their entirety. Consider the target audience (novice Python developers) and the context in which this is intended to be read (likely during a help session where said novice is focused mainly on solving a specific problem). As insightful as it is, I would like to see all discussion of classes and dunder methods removed.

Perhaps you could instead demonstrate how a function that returns a list of X could be refactored to generate X. Remember: for a novice Python developer, what's remarkable about generators is that they "go to sleep" between iterations and "keep all variables", or some phrasing along those lines.

@ionite34 ionite34 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reduced some details on generator internal states and classes to be more beginner-friendly.

Okimii and others added 6 commits August 6, 2022 17:12
Co-authored-by: Ionite <dev@ionite.io>
Co-authored-by: Ionite <dev@ionite.io>
Co-authored-by: Ionite <dev@ionite.io>
Co-authored-by: Ionite <dev@ionite.io>
Co-authored-by: Ionite <dev@ionite.io>
Co-authored-by: Ionite <dev@ionite.io>
@ghost

ghost commented Aug 6, 2022

Copy link
Copy Markdown
Author

@ionite34 well done especially on the implementation of examples!

Co-authored-by: Ionite <dev@ionite.io>
Okimii and others added 2 commits August 6, 2022 17:16
Co-authored-by: Ionite <dev@ionite.io>
Co-authored-by: Ionite <dev@ionite.io>
@ionite34
ionite34 dismissed their stale review August 6, 2022 21:33

Pending someone to review this in relation to policy

@ionite34

ionite34 commented Aug 6, 2022

Copy link
Copy Markdown
Contributor

For an additional note, the \ marks on lines 14, 26, 32, 37 need to be removed for the markdown to be valid.

@sue-m-oh

sue-m-oh commented Aug 7, 2022

Copy link
Copy Markdown
Contributor

We discussed during today's staff meeting, we would like to see this tag revamped/pivoted to a narrower scope, which also leverages and links to the Real Python article on generators.

Please let us know if you'd be interested in doing that @Okimii.

We will also work on better defining what criteria we feel a tag should meet to best serve as a teaching tool for a real-time communication platform such as Discord, and also make it a bit clearer that a PR for a tag should not be opened without further discussion on a meta issue first.

@ghost

ghost commented Aug 7, 2022

Copy link
Copy Markdown
Author

@minalike I wouldn't mind revamping the tag, I would love for the staff of pydis to make it better and more defined in the context of details for a better tag for beginners, I can also help with the structure of the tag but im not quite good with wording so I would really need help on that part, either way there's allot of talented people in pydis staff, e.g @ionite34 which has helped allot especially wording wise and the tags structure, so even if my wording isn't the best it can also be corrected which I do appreciate as it does help me.

@lemonsaurus

Copy link
Copy Markdown
Contributor

I'd like to see this shortened down dramatically.

  • I don't think we should explain iterators and generators in the same tag. Let's make this one solely about generators.
  • Tags should not be articles, and generators is a big topic which will not be sufficiently explained in a tag. In this case, it would be better to explain (in only a handful of words) what it is, how it's commonly used, and then link to a good resource for learning about it.
  • The RealPython article is a fantastic resource, and right now, I see no reason why I would use this tag instead of just linking that article directly. Let's instead make this tag a companion to that article, rather than trying to compete with it.

@ghost

ghost commented Aug 7, 2022

Copy link
Copy Markdown
Author

I love that idea.

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants